package org.ilovecode.display {
	
	import flash.display.MovieClip;
	import flash.display.SimpleButton;
	import flash.events.MouseEvent;
	
	import org.ilovecode.events.ChooserEvent;
	import org.ilovecode.screen.ScreenGroup;
	
	/**
	 * ...
	 * @author Vjekoslav Ratkajec
	 */
	public class Chooser extends MovieClip {
		
		//{ region Stage elements
		
		public var apartmentsButton:SimpleButton;
		public var businessButton:SimpleButton;
		
		//} endregion
		
		public function Chooser() {
			init();
		}
		
		private function init():void {
			initListeners();
		}
		
		private function initListeners():void {
			apartmentsButton.addEventListener(MouseEvent.CLICK, apartmentsButtonClicked);
			businessButton.addEventListener(MouseEvent.CLICK, businessButtonClicked);
		}
		
		private function apartmentsButtonClicked(event:MouseEvent):void {
			this.dispatchEvent(new ChooserEvent(ChooserEvent.CHOOSER_CLICKED, ScreenGroup.APARTMENTS));
		}
		
		private function businessButtonClicked(event:MouseEvent):void {
			this.dispatchEvent(new ChooserEvent(ChooserEvent.CHOOSER_CLICKED, ScreenGroup.BUSINESS));
		}
		
		
	}

}